import {HttpClient} from '@angular/common/http';
import { Injectable } from '@angular/core';


@Injectable()
export class PublicProvider {

  get_data_url = 'http://localhost/app/get_data.php';
  timeout1 = 0;
  device_list:any;
  scene_list:any;

  constructor(private http: HttpClient) {
    this.get_data();
    }

  get_data(){
    let p1 = {
      'table': 'device'
    };
    let p2 = {
      'table': 'scene'
    };

    this.http.get(this.get_data_url,{params: p1})
      .subscribe(data => {
        this.device_list = data;
        console.log(this.device_list);
      });

    this.http.get(this.get_data_url,{params: p2})
      .subscribe(data => {
        this.scene_list = data;
        console.log(this.scene_list);
      });
  }



}
